#include "mouse.h"

void ofxMouse::setCursorPosition(int x, int y) {
    #ifdef TARGET_WIN32
        SetCursorPos(x,y);
    #endif
}

void ofxMouse::leftButtonClick() {
    #ifdef TARGET_WIN32
        mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
    #endif
}

void ofxMouse::rightButtonClick() {
    #ifdef TARGET_WIN32
        mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
        mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
    #endif
}

void ofxMouse::centerCursorToScreen() {
    setCursorPosition(ofGetScreenWidth()/2,ofGetScreenHeight()/2);
}

void ofxMouse::centerCursorToWindow() {
    setCursorPosition(ofGetWidth()/2+ofGetWindowPositionX(),ofGetHeight()/2+ofGetWindowPositionY());
}
